<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>课工场,你的职业梦工厂!</title>
    <script src="./res/jquery-3.4.1.min.js"></script>
</head>

<body>
    <button id="ajaxBtn">你过来呀</button>
</body>

</html>
<script>
    $(function() {
        let user = {
            "account": "admin",
            "password": "123456"
        }
        $("ajaxBtn").click(function(e) {
            // e.preventDefault();
            $.ajax({
                type: "post",
                url: "http://localhost:8080/springmvc-sample03/ajax",
                data: user,
                dataType: "json",
                success: function(response) {
                    window.console.log(response);
                },
                error: function(response) {
                    window.console.log("服务器大大病了");
                }
            });
        });
    });
</script>